<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="model.Salesman, model.ActionConstants"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<?xml version="1.0" charset="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html>
  <head>
    <title>Pedidos</title>
  </head>
  <body>
    <u>Pedidos/status</u><br/>
    <a href="OrderServlet?action=<%=request.getParameter("return")%>">Volver</a>
    <table border="1">
      <tr>
        <td>X</td>
        <td>Nro</td>
        <td>Fecha</td>
        <td>Cliente</td>
        <td >Status</td>
      </tr>
      <c:forEach var="order" items="${requestScope.orderCatalog.orders}">
        <tr>
          <c:choose>
            <c:when test="${order.statusId !='PEN'}">
              <td></td>
              <td><a href="OrderServlet?action=showOrderDetails&id=${order.id}&return=<%=request.getParameter("return")%>">${order.id}</a></td>
              <td>${order.date}</td>
              <td>${order.customer.name}</td>&
              <td>${order.status}</td>
            </c:when>
            <c:otherwise>
              <td>
                <% if (((Salesman)session.getAttribute("salesman")).checkAction(ActionConstants.ELIM_PEDIDOS)) { %>
                  <a href="OrderServlet?action=removeOrd&id=${order.id}&return=<%=request.getParameter("return")%>">x</a>
                <% } %>  
              </td>
              <td><a href="OrderServlet?action=showOrderDetails&id=${order.id}&return=<%=request.getParameter("return")%>">${order.id}</a></td>
              <td><font color="#0000FF">${order.date}</font></td>
              <td><font color="#0000FF">${order.customer.name}</font></td>
              <td><font color="#0000FF">${order.status}</font></td>
            </c:otherwise>
          </c:choose>
        </tr>
      </c:forEach>
    </table>
    <a href="OrderServlet?action=<%=request.getParameter("return")%>">Volver</a>
  </body>
</html>
